package basic_1012;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		Scanner scanner=new Scanner(System.in);
		int number=scanner.nextInt()+scanner.nextInt();
		int D=scanner.nextInt();
		scanner.close();
		
		String result="";
		while(number>0) {
			result=""+number%D+result;
			number=number/D;
		}
		
		System.out.println(result);
	}
	
}
